import {apiPrefixDispose} from '@/utils/format';
import {request} from '@umijs/max';


/**
 * 当前access用户的域名列表
 */
export async function domains<T = any>(accessId: string) {
    return request<API.ResultVO<API.DnsDomain>>(apiPrefixDispose(`/recordParsing/domain/all/${accessId}`), {
      method: 'GET',
    });
  }


/**
 * domain的解析记录
 */
export async function records<T = any>(accessId: string, body: API.DnsDomain) {
  return request<API.ResultVO<API.DnsDomainRecord[]>>(apiPrefixDispose(`/recordParsing/domain/records/${accessId}`), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}




/**
 * 当前access用户的域名列表
 */
export async function deleteRecord<T = any>(params: API.DeleteRecord) {
  return request<API.ResultVO<API.DnsDomain>>(apiPrefixDispose(`/recordParsing/domain//delete/${params.accessId}/${params.recordId}/${params.cloud}`), {
    method: 'GET',
    timeout: -1,
    params: { 'zoneId': params.zoneId  },
  });
}
